package com.zuihai.app.mvp.ui.activity.find.newfind;

import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zuihai.app.mvp.constant.DetailConstant;
import com.zuihai.app.mvp.constant.ReleaseConstant;
import com.zuihai.app.mvp.model.entity.HomeItem;
import com.zuihai.app.mvp.ui.activity.detail.DetailContainerActivity;
import com.zuihai.app.mvp.ui.activity.home.HomeRecyclerFragment;

import java.util.Calendar;

/**
 * Created by Zc on 2017/5/9.
 * 发现-发现秘密
 */

public class NewFindSecretFragment extends HomeRecyclerFragment {

    public static NewFindSecretFragment newInstance() {

        Bundle args = new Bundle();

        NewFindSecretFragment fragment = new NewFindSecretFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected void requestData(boolean isRefresh) {
        mPresenter.requestSecret(isRefresh);
    }

    @Override
    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            HomeItem item = (HomeItem) adapter.getItem(position);
            String detailId = item.id;

            DetailContainerActivity.launchActivity(getContext(), DetailConstant.HEADLINE_TYPE,
                    ReleaseConstant.zhanwei+"", detailId);
        }
    }
}
